﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace MiniWeb.M.Controllers.ViewModels
{
    public class RegisterModel
    {
        [Display(Name = "账号"), Required]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "用户名不能大于{2} 且要小于{1}")]
        public string Account { get; set; }

        [Display(Name = "登录密码"),Required(ErrorMessage = "必须")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "密码必须在{2} 和{1}之间")]
        public string Pwd { get; set; }

        [Compare("Pwd", ErrorMessage = "密码要相同")]
        public string CPwd { get; set; }

        [Display(Name = "手机")]
        [RegularExpression(@"^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$", ErrorMessage = "{0}的格式不正确")]
        public string Phone { get; set; }
        
        [Display(Name = "验证码")]
        public string ValidCode { get; set; }

        [Display(Name = "Email")][Required(AllowEmptyStrings = false, ErrorMessage = "邮箱必填")]
        [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9]+\.[A-Za-z]{2,4}", ErrorMessage = "{0}的格式不正确")]
        public string Email { get; set; }
    }
}
